Skip to content

TST: strictly xfail mid-test #38881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

rhshadrach
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • passes black pandas
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

Using pytest.xfail when a test is running will immediately stop the test and will not xpass if test would otherwise succeed. It doesn't seem to be documented anywhere, but an alternative would be to use the request fixture. In this demo, I've added an xfail that runs successfully, making the test fail (xpass).

If this looks like a good idea, I can make a tracking issue to replace pytest.xfail with the method used here.

@rhshadrach rhshadrach added the Testing pandas testing functions or related to the test suite label Jan 1, 2021
@jreback
Copy link
Contributor

jreback commented Jan 1, 2021

a fair amount of the xfails are already like this

sure i think we should be consistent and change then all

@rhshadrach
Copy link
Member Author

@jreback Not certain, but I think you may be referring to using the pytest.mark.xfail decorator. The decorator has limitations, in the case shown here it can't be used with the fixture transformation_func.

A search for "applymarker" turns up empty across all our tests.

@jreback
Copy link
Contributor

jreback commented Jan 1, 2021

not at all search for

mark = pytest.mark.xfail(
                reason="BUG: it must be pd.Series([1, 1, 3, 4], dtype=np.int16"
            )
request.node.add_marker(mark)

for example

~/pandas$ grep -r add_marker pandas | wc
      49      99    4128

@rhshadrach
Copy link
Member Author

Thanks, request.applymarker is the same as request.node.add_marker, I'll stick to add_marker for consistency.

@rhshadrach rhshadrach marked this pull request as draft January 1, 2021 20:48
@jreback
Copy link
Contributor

jreback commented Jan 1, 2021

yeah i think @jbrockmendel started putting these in recently. we should change all occurernces, update the docs and put in a pre-commit hook (once all fixed).

@rhshadrach rhshadrach mentioned this pull request Jan 2, 2021
5 tasks
@rhshadrach rhshadrach closed this Jan 2, 2021
@rhshadrach rhshadrach deleted the xfail_some branch January 2, 2021 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants